<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateBonusesTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bonuses', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 32);
            $table->integer('user_id')->default(0);
            $table->integer('distribute_id')->default(0);
            $table->decimal('money', 10, 2)->default(0);
            $table->integer('type')->default(1);
            $table->decimal('min_amount', 10, 2)->default(0);
            $table->decimal('max_amount', 10, 2)->default(0);
            $table->timestamp('send_start_date')->nullable();
            $table->timestamp('send_end_date')->nullable();
            $table->timestamp('use_start_date')->nullable();
            $table->timestamp('use_end_date')->nullable();
            $table->timestamp('use_date')->nullable();
            $table->integer('use_status')->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('bonuses');
    }
}
